cap confirm file "$data_out/Clearances.dta" 
if _rc!=0 { 
do "$Outcomes/Clearances.do"
}
else use "$data_out/Clearances.dta", clear 

label var ed_prescription "Prescription in ED"
label var revoke "Clearance Revoked within 1 Year"
label var revoke2  "Clearance Revoked within 2 Years"
label var denied "Denied a Clearance within 1 Year"
label var denied2 "Denied a Clearance within 2 Years"
label var granted "Hold a Security Clearance within 1 Year"
label var granted2 "Hold a Security Clearance within 2 Years"



foreach outcome in  granted denied revoke granted2 denied2 revoke2 {
eststo `outcome'_C:	ivreghdfe `outcome' $spec1

eststo `outcome'_Q:	ivreghdfe `outcome' $spec2
estadd ysumm, replace
}

#delimit ;

	//word
esttab granted_C denied_C revoke_C granted2_C denied2_C revoke2_C using "clearance.rtf" , 
	replace label se star(* 0.10 ** 0.05 *** 0.01)
	b(4) se(4)
	stats(ymean N ,
	fmt(a2 %-9.0fc)
	label("Sample Mean" "Observations"))
		keep(ed_prescription)
		title(IV Results for Security Clearances - Prescribing Rate Instrument);
		
	
esttab granted_Q denied_Q revoke_Q granted2_Q denied2_Q revoke2_Q using "clearance.rtf" ,  
	append label se star(* 0.10 ** 0.05 *** 0.01)
	b(4) se(4)
	stats(ymean N ,
	fmt(a2 %-9.0fc)
	label("Sample Mean" "Observations"))
		keep(ed_prescription)
		title(IV Results for Security Clearances - 4th vs 1st Quartile Instrument);
		
 
#delimit cr


